import { IFeidaoAiBrowserComponent } from '@feidao/web/interfaces';
import { file_url, spaceid, get_user_info } from './config';
import whoami from '@feidao/web/atom/browser/msg/whoami';
// 头部
export default async function a001(fd: IFeidaoAiBrowserComponent, ...args: any[]) {
	const name = fd.data.node.getAttribute('name');
	if (fd.data.node.querySelector('[data-feidao-head="name"]')) {
		fd.data.node.querySelector('[data-feidao-head="name"]').innerHTML = name;
	}
	const user = await whoami(get_user_info) as {
		avatar_path: string;
		usercode: string;
		user_name: string;
	};
	fd.data.node.querySelector('[data-feidao-name="user_name"]').innerHTML = user.user_name + ``;
	if (user.avatar_path) {
		fd.data.node.querySelector<HTMLImageElement>('[data-feidao-name="msg"]').src = `${file_url}getfile?productid=${spaceid}&id=${user.avatar_path}`;
	}


}
